package com.lgr.store.dao;

import org.apache.ibatis.annotations.Param;
import com.lgr.store.utils.PageObject;
import com.lgr.store.vo.DataBean;
import com.lgr.store.vo.DepVo;
import com.lgr.store.vo.MaterialVo;
import com.lgr.store.vo.OrderDetailVo;
import com.lgr.store.vo.OrdersVo;
import com.lgr.store.vo.StorageVo;
import com.lgr.store.vo.SupplierVo;

import java.util.List;
import java.util.Map;

public interface OrdersDAO {

    //查询
    List<OrdersVo> listAll(@Param("ord") OrdersVo order, @Param("pager") PageObject pager);
    //统计记录数
    int getcount(@Param("ord") OrdersVo order);
    //新增
    void addOrder(OrdersVo order);
    //新增
    void addDetail(OrderDetailVo orderDetail);
    //根据id返回信息
    OrdersVo findById(String orderNo);
    //根据id返回信息
    List<OrderDetailVo> findByOrderNo(String orderNo);
    
    List<SupplierVo> findAllSupplier();
    List<StorageVo> findAllStorage();
    List<MaterialVo> findMaterialByCode(@Param("materialCode") String materialCode);
    MaterialVo findMaterialByCode2(@Param("materialId") int materialId);

    //通过订单号或者批号从订单明细表查询
    List<OrderDetailVo>  findDetailByBatchNo(@Param("detail") OrderDetailVo orderDetailVo);
    //通过订单号或者批号从订单明细表查询(退料使用)
    List<OrderDetailVo>  findDetailByBatchNo3(@Param("detail") OrderDetailVo orderDetailVo);
    int findByBatchNo(@Param("batchNo") String batchNo,@Param("orderType") int orderType,@Param("orderFlag") String orderFlag);
    
    String getOrderId(Map<String, String> params);
    //删除订单
    void  delOrder(@Param("orderNo") String orderNo);
    //按orderNo删除订单明细
    void  delOrderDetail(@Param("orderNo") String orderNo);
    //按orderDetailId删除订单明细
    void  delRow(@Param("orderDetailId") Integer orderDetailId);
    //审核状态
    void updateAduit(OrdersVo order);
    //作废
    void updateStat(OrdersVo order);
    void updateOrder(OrdersVo order);
    void updateDetail(OrderDetailVo orderDetail);
    //修改订单明细库存信息，仅仅在退料模块使用 
    void updateDetailCnt(@Param("detail") OrderDetailVo detail);
    //计算库存
    float getStorageCnt(@Param("detail") OrderDetailVo detail);

}